package com.cdream.basic.algorithm.leetcode.dfs;

import java.util.ArrayList;
import java.util.List;

/**
 * @author cdream
 * @date 6/4/21
 */
public class Question78 {
    private List<List<Integer>> res = new ArrayList<>();

    public List<List<Integer>> subsets(int[] nums) {
        res.add(new ArrayList<>());
        for (int num : nums) {
            int size = res.size();
            for (int i1 = 0; i1 < size; i1++) {
                List<Integer> integers = res.get(i1);
                List<Integer> midList = new ArrayList<>(integers);
                midList.add(num);
                res.add(midList);
            }
        }
        return res;
    }
}
